import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Dialogs 1.2

import TH.OpenCVFrame 1.0
import TH.DisPlayContent 1.0

//import CustomGeometry 1.0

ApplicationWindow {
    visible: true;
    width: 1024;
    height: 768;
    title: qsTr("Hello World");

    BackGround {
        anchors.centerIn: parent;
    }

    DisPlayContent
    {
        id:disPlayContent;
    }

    onClosing:
    {
//        console.log("onClosing")
//         view.deleteView()
    }


    OpenCVFrame {
        anchors.centerIn: parent;
//        anchors {left:parent.left; top:parent.top}
        id:opencvFrame;
//        frameRate: 33
        width: 1024;
        height: 768;
    }

    ShowText {
        id:showTxt;
        anchors.centerIn: parent;
    }

    Item {
        Timer {
            interval: 100;
            running:true;
            repeat:true;
            onTriggered: {
                opencvFrame.update();
                updateContent();
//                console.log("update")
            }
        }
    }

    function updateContent(){
        showTxt.camGain.text=qsTr(disPlayContent.camGain.toString());
        showTxt.camFocus.text = qsTr(disPlayContent.camFocus.toString());
        showTxt.contrast.text = qsTr(disPlayContent.contrast.toString());
        showTxt.viewField.text = qsTr(disPlayContent.viewField.toFixed(1).toString());
        showTxt.outMode.text = qsTr(disPlayContent.outModeStr);
        showTxt.workMode.text=qsTr(disPlayContent.workModeStr);
        showTxt.videoRecordState.text=qsTr(disPlayContent.videoRecordSateStr);
        showTxt.softVersion.text=qsTr(disPlayContent.softVersion.toFixed(2).toString());
        showTxt.cross.visible = disPlayContent.crossState;
        if(disPlayContent.outModeInt === 2)
        {
            showTxt.visible = true;
        }
        else
        {
            showTxt.visible = false;
        }

        showTxt.showInf.text = disPlayContent.showInf;


    }

}
